import java.util.Arrays;
import java.util.Scanner;

public class NewKe {
    public static int[] sortedSquares(int[] b) {

        int[] a = new int[b.length];
        for (int i = 0; i < b.length; i++){
            a[i] = b[i] * b[i];
        }

        for (int i = 0; i< a.length; i++){
            for(int j = i+1; j< a.length; j++){
                if (a[i] > a[j]) {
                    int temp = a[i];
                    a[i] = a[j];
                    a[j] = temp;
                }
            }
        }
        return a;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.next().toString();
        String[] arr  = str.split(",");
        int[] b = new int[arr.length];
        for(int j = 0; j<b.length;j++) {
            b[j] = Integer.parseInt(arr[j]);
        }
//        int[] a = sortedSquares(b);
        int[] a = new int[b.length];
        a = sortedSquares(b);
        String ret = Arrays.toString(a);
        System.out.println(ret);
    }
}
